home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / linux-bo / etherboo.000 / etherboo / etherboot-2.0 / patches / netboot-freebsd-compiles-with-linux.patch < prev    next >
Text File  |  1995-09-14  |  17KB  |  538 lines

  1. diff -u -r -N netboot-freebsd-orig/Makefile.linux netboot-freebsd/Makefile.linux
  2. --- netboot-freebsd-orig/Makefile.linux    Thu Jan  1 01:00:00 1970
  3. +++ netboot-freebsd/Makefile.linux    Sat Sep  9 00:23:05 1995
  4. @@ -0,0 +1,85 @@
  5. +#    Makefile,v 1.4 1994/12/31 17:16:49 jkh Exp
  6. +#
  7. +# Makefile for NETBOOT
  8. +#
  9. +# Basic Options:
  10. +#    -DASK_BOOT    - Ask "Boot from Network (Y/N) ?" at startup
  11. +#    -DROMSIZE    - Size of EPROM - Must be set (even for .COM files)
  12. +#    -DRELOC        - Relocation address (usually 0x90000)
  13. +#
  14. +# NS8390 Options:
  15. +#    -DINCLUDE_WD    - Include Western Digital/SMC support
  16. +#    -DINCLUDE_NE    - Include NE1000/NE2000 support
  17. +#    -DINCLUDE_3COM  - Include 3c503 support
  18. +#       -D_3COM_USE_AUI - Disable transceiver on 3c503 by default
  19. +#    -DNE_BASE    - Base I/O address for NE1000/NE2000
  20. +#    -DNE_NOSCAN    - Do not try to automatically find NEx000 I/O address
  21. +#       -D_3COM_BASE    - Base I/O address for 3c503
  22. +#    -DWD_DEFAULT_MEM- Default memory location for WD/SMC cards
  23. +# XXX nothing depends on this Makefile so you must run `make clean' after
  24. +# changing an option.
  25. +#
  26. +
  27. +PROG=    nb8390.com nb3c509.com nb8390.rom nb3c509.rom
  28. +# Order is very important on the SRCS line for this prog
  29. +SRCS=    start2.S  main.c misc.c bootmenu.c rpc.c
  30. +OBJS=   start2.o  main.o misc.o bootmenu.o rpc.o
  31. +ROBJS=  start2.ro main.o misc.o bootmenu.o rpc.o
  32. +
  33. +CFLAGS=        -O2 -DNFS -DROMSIZE=${ROMSIZE} -DRELOC=${RELOCADDR}
  34. +CFLAGS+=    -fstrength-reduce -fomit-frame-pointer -m386
  35. +# NS8390=    -DINCLUDE_WD -DWD_DEFAULT_MEM=0xD0000
  36. +NS8390+=    -DINCLUDE_NE
  37. +# NS8390+=    -DINCLUDE_3COM -D_3COM_BASE=0x300
  38. +CLEANFILES=    ${OBJS}
  39. +CLEANFILES+=    nb8390.bin nb3c509.bin nb8390c.bin nb3c509c.bin
  40. +CLEANFILES+=    makerom start2.ro 3c509.o ns8390.o
  41. +LDFLAGS+=    -N -Ttext ${RELOCADDR} -e _start -nostdlib
  42. +
  43. +ROMSIZE=16384
  44. +RELOCADDR=0x90000
  45. +
  46. +.SUFFIXES:    .ro
  47. +
  48. +all: ${PROG}
  49. +
  50. +clean:
  51. +    ${RM} -rf ${CLEANFILES}
  52. +
  53. +.S.ro:
  54. +    ${CC} ${CFLAGS} -DBOOTROM -o $@ -c $<
  55. +
  56. +.S.o:
  57. +    ${CC} ${CFLAGS}           -o $@ -c $<
  58. +
  59. +ns8390.o:    ns8390.c
  60. +    ${CC} $(CFLAGS) $(NS8390) -o $@ -c $<
  61. +
  62. +makerom: makerom.c
  63. +    ${CC} -o $@ -DROMSIZE=${ROMSIZE} ./makerom.c
  64. +
  65. +nb8390.rom:    makerom start2.ro ${ROBJS} ns8390.o
  66. +    ${LD} ${LDFLAGS} -o nb8390.bin ${ROBJS} ns8390.o
  67. +    strip nb8390.bin
  68. +    size nb8390.bin
  69. +    objdump -k -q -o ${RELOCADDR} nb8390.bin >$@
  70. +    ./makerom $@
  71. +
  72. +nb3c509.rom:    makerom start2.ro ${ROBJS} 3c509.o
  73. +    ${LD} ${LDFLAGS} -o nb3c509.bin ${ROBJS} 3c509.o
  74. +    strip nb3c509.bin
  75. +    size nb3c509.bin
  76. +    objdump -k -q -o ${RELOCADDR} nb3c509.bin >$@
  77. +    ./makerom $@
  78. +
  79. +nb8390.com:    makerom start2.ro ${OBJS} ns8390.o
  80. +    ${LD} ${LDFLAGS} -o nb8390c.bin ${OBJS} ns8390.o
  81. +    strip nb8390c.bin
  82. +    size nb8390c.bin
  83. +    objdump -k -q -o ${RELOCADDR} nb8390c.bin >$@
  84. +
  85. +nb3c509.com:    start2.o ${OBJS} 3c509.o
  86. +    ${LD} ${LDFLAGS} -o nb3c509c.bin ${OBJS} 3c509.o
  87. +    strip nb3c509c.bin
  88. +    size nb3c509c.bin
  89. +    objdump -k -q -o ${RELOCADDR} nb3c509c.bin >$@
  90. diff -u -r -N netboot-freebsd-orig/linuxdef.h netboot-freebsd/linuxdef.h
  91. --- netboot-freebsd-orig/linuxdef.h    Thu Jan  1 01:00:00 1970
  92. +++ netboot-freebsd/linuxdef.h    Fri Sep  8 15:20:33 1995
  93. @@ -0,0 +1,203 @@
  94. +/*
  95. + * This file contains definitions for compiling the FreeBSD-based code
  96. + * on a Linux system. It has been collected from misc. header files of
  97. + * the FreeBSD distribution. Therefore the following copyright conditions
  98. + * apply
  99. + */
  100. +
  101. +/*-
  102. + * Copyright (c) 1992, 1993
  103. + *    The Regents of the University of California.  All rights reserved.
  104. + *
  105. + * Redistribution and use in source and binary forms, with or without
  106. + * modification, are permitted provided that the following conditions
  107. + * are met:
  108. + * 1. Redistributions of source code must retain the above copyright
  109. + *    notice, this list of conditions and the following disclaimer.
  110. + * 2. Redistributions in binary form must reproduce the above copyright
  111. + *    notice, this list of conditions and the following disclaimer in the
  112. + *    documentation and/or other materials provided with the distribution.
  113. + * 3. All advertising materials mentioning features or use of this software
  114. + *    must display the following acknowledgement:
  115. + *    This product includes software developed by the University of
  116. + *    California, Berkeley and its contributors.
  117. + * 4. Neither the name of the University nor the names of its contributors
  118. + *    may be used to endorse or promote products derived from this software
  119. + *    without specific prior written permission.
  120. + *
  121. + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  122. + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  123. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  124. + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  125. + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  126. + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  127. + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  128. + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  129. + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  130. + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  131. + * SUCH DAMAGE.
  132. + *
  133. + */
  134. +
  135. +#ifndef __LINUXDEF_H__
  136. +#define __LINUXDEF_H__
  137. +
  138. +#include <asm/byteorder.h>
  139. +#include <asm/io.h>
  140. +#include <sys/types.h>
  141. +
  142. +/* Linux reverses the order of the parameters, so change the macros */
  143. +#undef outb
  144. +#define outb(port,val) \
  145. +((__builtin_constant_p((port)) && (port) < 256) ? \
  146. +    __outbc((val),(port)) : \
  147. +    __outb((val),(port)))
  148. +#undef outw
  149. +#define outw(port,val) \
  150. +((__builtin_constant_p((port)) && (port) < 256) ? \
  151. +    __outwc((val),(port)) : \
  152. +    __outw((val),(port)))
  153. +
  154. +#define    IFNAMSIZ    16
  155. +#define    NGROUPS_MAX    16        /* max supplemental group id's */
  156. +#define    NGROUPS        NGROUPS_MAX    /* max number groups */
  157. +#define    NFSX_V2FH    32
  158. +#define MNAMELEN    90        /* length of buffer for returned name*/
  159. +#define MAXHOSTNAMELEN    256        /* max hostname size */
  160. +#define    SOCK_STREAM    1        /* stream socket */
  161. +#define    SOCK_DGRAM    2        /* datagram socket */
  162. +#define    NFSMNT_SOFT    0x00000001    /* soft mount (hard is default) */
  163. +#define    NFSMNT_WSIZE    0x00000002    /* set write size */
  164. +#define    NFSMNT_RSIZE    0x00000004    /* set read size */
  165. +#define    NFSMNT_INT    0x00000040    /* allow interrupts on hard mount */
  166. +#define    NFSMNT_RESVPORT    0x00008000    /* Allocate a reserved port */
  167. +#define    NFSERR_PERM    1
  168. +#define    NFSERR_NOENT    2
  169. +#define    NFSERR_ACCES    13
  170. +#define    AF_UNSPEC    0        /* unspecified */
  171. +#define    AF_INET        2        /* internetwork: UDP, TCP, etc. */
  172. +#define CLSIZELOG2    0
  173. +#define CLSIZE        (1 << CLSIZELOG2)
  174. +#define PAGE_SHIFT    12
  175. +#define NBPG        (1 << PAGE_SHIFT) /* bytes/page */
  176. +#define    CLOFSET        (CLSIZE*NBPG-1)    /* for clusters, like PGOFSET */
  177. +#define    BOOTINFO_VERSION 1
  178. +#define    N_BIOS_GEOM    8
  179. +#define    NODEV        (dev_t)(-1)    /* non-existent device */
  180. +#define    OMAGIC        0407        /* old impure format */
  181. +#define    NMAGIC        0410        /* read-only text */
  182. +#define    ZMAGIC        0413        /* demand load format */
  183. +#define QMAGIC          0314        /* "compact" demand load format */
  184. +#define __LDPGSZ    4096
  185. +
  186. +#define N_GETMAGIC(ex) \
  187. +    ( (ex).a_midmag & 0xffff )
  188. +#define N_GETMAGIC_NET(ex) \
  189. +    (ntohl((ex).a_midmag) & 0xffff)
  190. +#define    N_BADMAG(ex) \
  191. +    (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \
  192. +     N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \
  193. +     N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \
  194. +     N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC)
  195. +#define    N_TXTOFF(ex) \
  196. +    (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \
  197. +    N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec))
  198. +
  199. +struct sockaddr {
  200. +    u_char    sa_len;            /* total length */
  201. +    u_char    sa_family;        /* address family */
  202. +    char    sa_data[14];        /* actually longer; address value */
  203. +};
  204. +
  205. +struct in_addr {
  206. +    u_long s_addr;
  207. +};
  208. +
  209. +struct sockaddr_in {
  210. +    u_char    sin_len;
  211. +    u_char    sin_family;
  212. +    u_short    sin_port;
  213. +    struct    in_addr sin_addr;
  214. +    char    sin_zero[8];
  215. +};
  216. +
  217. +struct ifaliasreq {
  218. +    char    ifra_name[IFNAMSIZ];        /* if name, e.g. "en0" */
  219. +    struct    sockaddr ifra_addr;
  220. +    struct    sockaddr ifra_broadaddr;
  221. +    struct    sockaddr ifra_mask;
  222. +};
  223. +
  224. +struct nfs_args {
  225. +    struct sockaddr    *addr;        /* file server address */
  226. +    int        addrlen;    /* length of address */
  227. +    int        sotype;        /* Socket type */
  228. +    int        proto;        /* and Protocol */
  229. +    u_char        *fh;        /* File handle to be mounted */
  230. +    int        fhsize;        /* Size, in bytes, of fh */
  231. +    int        flags;        /* flags */
  232. +    int        wsize;        /* write size in bytes */
  233. +    int        rsize;        /* read size in bytes */
  234. +    int        readdirsize;    /* readdir size in bytes */
  235. +    int        timeo;        /* initial timeout in .1 secs */
  236. +    int        retrans;    /* times to retry send */
  237. +    int        maxgrouplist;    /* Max. size of group list */
  238. +    int        readahead;    /* # of blocks to readahead */
  239. +    int        leaseterm;    /* Term (sec) of lease */
  240. +    int        deadthresh;    /* Retrans threshold */
  241. +    char        *hostname;    /* server's name */
  242. +};
  243. +
  244. +struct ucred {
  245. +    u_short    cr_ref;            /* reference count */
  246. +    uid_t    cr_uid;            /* effective user id */
  247. +    short    cr_ngroups;        /* number of groups */
  248. +    gid_t    cr_groups[NGROUPS];    /* groups */
  249. +};
  250. +
  251. +struct nfs_diskless {
  252. +    struct ifaliasreq myif;            /* Default interface */
  253. +    struct sockaddr_in mygateway;        /* Default gateway */
  254. +    struct nfs_args    swap_args;        /* Mount args for swap file */
  255. +    u_char        swap_fh[NFSX_V2FH];    /* Swap file's file handle */
  256. +    struct sockaddr_in swap_saddr;        /* Address of swap server */
  257. +    char        swap_hostnam[MNAMELEN];    /* Host name for mount pt */
  258. +    int        swap_nblks;        /* Size of server swap file */
  259. +    struct ucred    swap_ucred;        /* Swap credentials */
  260. +    struct nfs_args    root_args;        /* Mount args for root fs */
  261. +    u_char        root_fh[NFSX_V2FH];    /* File handle of root dir */
  262. +    struct sockaddr_in root_saddr;        /* Address of root server */
  263. +    char        root_hostnam[MNAMELEN];    /* Host name for mount pt */
  264. +    long        root_time;        /* Timestamp of root fs */
  265. +    char        my_hostnam[MAXHOSTNAMELEN]; /* Client host name */
  266. +};
  267. +
  268. +struct bootinfo {
  269. +    unsigned int        bi_version;
  270. +    unsigned char        *bi_kernelname;
  271. +    struct nfs_diskless    *bi_nfs_diskless;
  272. +                /* End of fields that are always present. */
  273. +#define    bi_endcommon        bi_n_bios_used
  274. +    unsigned int        bi_n_bios_used;
  275. +    unsigned long        bi_bios_geom[N_BIOS_GEOM];
  276. +    unsigned int        bi_size;
  277. +    unsigned char        bi_memsizes_valid;
  278. +    unsigned char        bi_pad[3];
  279. +    unsigned long        bi_basemem;
  280. +    unsigned long        bi_extmem;
  281. +    unsigned long        bi_symtab;
  282. +    unsigned long        bi_esymtab;
  283. +};
  284. +
  285. +struct exec {
  286. +     unsigned long    a_midmag;    /* flags<<26 | mid<<16 | magic */
  287. +     unsigned long    a_text;        /* text segment size */
  288. +     unsigned long    a_data;        /* initialized data size */
  289. +     unsigned long    a_bss;        /* uninitialized data size */
  290. +     unsigned long    a_syms;        /* symbol table size */
  291. +     unsigned long    a_entry;    /* entry point */
  292. +     unsigned long    a_trsize;    /* text relocation size */
  293. +     unsigned long    a_drsize;    /* data relocation size */
  294. +};
  295. +
  296. +#endif
  297. diff -u -r -N netboot-freebsd-orig/main.c netboot-freebsd/main.c
  298. --- netboot-freebsd-orig/main.c    Tue May 30 10:55:00 1995
  299. +++ netboot-freebsd/main.c    Fri Sep  8 10:59:08 1995
  300. @@ -31,6 +31,10 @@
  301.  /**************************************************************************
  302.  MAIN - Kick off routine
  303.  **************************************************************************/
  304. +#ifdef __linux
  305. +_main() {main();}
  306. +#endif
  307. +
  308.  main()
  309.  {
  310.      int c;
  311. diff -u -r -N netboot-freebsd-orig/makerom.c netboot-freebsd/makerom.c
  312. --- netboot-freebsd-orig/makerom.c    Wed Apr 12 20:48:00 1995
  313. +++ netboot-freebsd/makerom.c    Fri Sep  8 11:12:46 1995
  314. @@ -24,10 +24,12 @@
  315.          exit(2);
  316.      }
  317.      bzero(rom, ROMSIZE);
  318. +#ifndef __linux
  319.      if (lseek(fd, (off_t)32, SEEK_SET) < 0) {
  320.          perror("lseek error");
  321.          exit(2);
  322.      }
  323. +#endif
  324.      if (read(fd, rom, ROMSIZE) < 0) {
  325.          perror("read error");
  326.          exit(2);
  327. diff -u -r -N netboot-freebsd-orig/netboot.h netboot-freebsd/netboot.h
  328. --- netboot-freebsd-orig/netboot.h    Wed Apr 12 20:48:00 1995
  329. +++ netboot-freebsd/netboot.h    Thu Sep  7 19:54:14 1995
  330. @@ -6,6 +6,9 @@
  331.  
  332.  **************************************************************************/
  333.  
  334. +#ifdef __linux
  335. +#include "linuxdef.h"
  336. +#else
  337.  #include <sys/types.h>
  338.  #include <a.out.h>
  339.  #include <netdb.h>
  340. @@ -18,6 +21,7 @@
  341.  #include <nfs/nfsdiskless.h>
  342.  #include <machine/bootinfo.h>
  343.  #include <machine/cpufunc.h>
  344. +#endif
  345.  
  346.  #define ESC        0x1B
  347.  
  348. diff -u -r -N netboot-freebsd-orig/ns8390.c netboot-freebsd/ns8390.c
  349. --- netboot-freebsd-orig/ns8390.c    Tue May 30 10:55:00 1995
  350. +++ netboot-freebsd/ns8390.c    Sat Sep  9 00:23:55 1995
  351. @@ -270,6 +270,7 @@
  352.          eth_bmem = (char *)0;        /* No shared memory */
  353.          eth_asic_base = NE_BASE + NE_ASIC_OFFSET;
  354.          eth_nic_base = NE_BASE;
  355. +    scanaddr:
  356.          eth_vendor = VENDOR_NOVELL;
  357.          eth_flags = FLAG_PIO;
  358.          eth_memsize = MEM_16384;
  359. @@ -295,7 +296,18 @@
  360.              outb(eth_nic_base + D8390_P0_PSTOP, MEM_32768);
  361.              eth_pio_write(test, 16384, sizeof(test));
  362.              eth_pio_read(16384, testbuf, sizeof(test));
  363. -            if (!bcompare(testbuf, test, sizeof(test))) return (0);
  364. +            if (!bcompare(testbuf, test, sizeof(test))) {
  365. +#ifndef NE_NOSCAN
  366. +              static int idx=0,base[5]={0x320,0x340,0x360,0x300,0};
  367. +            skip:
  368. +              if ((eth_nic_base = base[idx++]) != 0) {
  369. +                if (eth_nic_base == NE_BASE) goto skip;
  370. +                eth_asic_base = eth_nic_base + NE_ASIC_OFFSET;
  371. +                goto scanaddr;
  372. +              }
  373. +#endif
  374. +              return (0);
  375. +            }
  376.          }
  377.          eth_pio_read(0, romdata, 16);
  378.          printf("\r\nNE1000/NE2000 base 0x%x, addr ", eth_nic_base);
  379. diff -u -r -N netboot-freebsd-orig/start2.S netboot-freebsd/start2.S
  380. --- netboot-freebsd-orig/start2.S    Mon Oct 17 00:00:00 1994
  381. +++ netboot-freebsd/start2.S    Fri Sep  8 11:04:11 1995
  382. @@ -12,6 +12,9 @@
  383.   * executed from an address it was not linked to. Code must be pic and
  384.   * 32 bit sensitive until things are fixed up.
  385.   */
  386. +#ifdef __linux
  387. +_romstart:
  388. +#endif
  389.  #ifdef BOOTROM
  390.      .word    0xaa55            /* bios extension signature */
  391.      .byte    (ROMSIZE>>9)        /* no. of 512B blocks */
  392. @@ -35,7 +38,11 @@
  393.      .byte    0xa3            /* MOV %ax, 0x302 */
  394.      .word    0x302
  395.      .byte    0xb8            /* MOV $_start-RELOCADDR, %ax */
  396. +#ifndef __linux
  397.      .word    (_start-RELOC)
  398. +#else
  399. +    .word    (_start-_romstart)
  400. +#endif
  401.      .byte    0xa3            /* MOV %ax, 0x64 */
  402.      .word    0x64
  403.      mov    %cs,%ax
  404. @@ -54,6 +61,8 @@
  405.  START - Where all the fun begins....
  406.  **************************************************************************/
  407.      .globl    _start
  408. +    .globl    start
  409. +start:
  410.  _start:
  411.      cli
  412.      cld
  413. @@ -73,7 +82,11 @@
  414.          rep
  415.          movsb
  416.      opsize
  417. +#ifndef __linux
  418.      ljmp    $(RELOC>>4),$1f-RELOC        /* Jmp to RELOC:1f */
  419. +#else
  420. +    ljmp    $(RELOC>>4),$1f-_romstart    /* Jmp to RELOC:1f */
  421. +#endif
  422.  1:
  423.      nop
  424.      mov    %cs,%ax
  425. @@ -87,6 +100,8 @@
  426.      call    _real_to_prot
  427.      call    _main
  428.      .globl    _exit
  429. +    .globl    exit
  430. +exit:
  431.  _exit:
  432.      call    _prot_to_real
  433.  #ifdef BOOTROM
  434. @@ -107,6 +122,8 @@
  435.  CURRTICKS - Get Time
  436.  **************************************************************************/
  437.      .globl    _currticks
  438. +    .globl    currticks
  439. +currticks:
  440.  _currticks:
  441.      push    %ebp
  442.      mov    %esp,%ebp
  443. @@ -131,6 +148,8 @@
  444.  PUTCHAR - Print a character
  445.  **************************************************************************/
  446.      .globl    _putchar
  447. +    .globl    putchar
  448. +putchar:
  449.  _putchar:
  450.      push    %ebp
  451.      mov    %esp,%ebp
  452. @@ -154,6 +173,8 @@
  453.  GETCHAR - Get a character
  454.  **************************************************************************/
  455.      .globl    _getchar
  456. +    .globl    getchar
  457. +getchar:
  458.  _getchar:
  459.      push    %ebp
  460.      mov    %esp,%ebp
  461. @@ -174,6 +195,8 @@
  462.  ISKEY - Check for keyboard interrupt
  463.  **************************************************************************/
  464.      .globl    _iskey
  465. +    .globl    iskey
  466. +iskey:
  467.  _iskey:
  468.      push    %ebp
  469.      mov    %esp,%ebp
  470. @@ -206,6 +229,8 @@
  471.   */
  472.  
  473.      .globl    _setjmp
  474. +    .globl    setjmp
  475. +setjmp:
  476.  _setjmp:
  477.      movl    4(%esp),%ecx 
  478.      movl    0(%esp),%edx
  479. @@ -220,6 +245,8 @@
  480.      ret
  481.  
  482.      .globl    _longjmp
  483. +    .globl    longjmp
  484. +longjmp:
  485.  _longjmp:
  486.      movl    4(%esp),%edx
  487.      movl    8(%esp),%eax
  488. @@ -239,6 +266,8 @@
  489.  ___MAIN - Dummy to keep GCC happy
  490.  **************************************************************************/
  491.      .globl    ___main
  492. +    .globl    __main
  493. +__main:
  494.  ___main:
  495.      ret
  496.  
  497. @@ -246,11 +275,17 @@
  498.  REAL_TO_PROT - Go from REAL mode to Protected Mode
  499.  **************************************************************************/
  500.      .globl    _real_to_prot
  501. +    .globl    real_to_prot
  502. +real_to_prot:
  503.  _real_to_prot:
  504.      cli
  505.      cs
  506.      addrsize
  507. -    lgdt    gdtarg-RELOC
  508. +#ifndef __linux
  509. +    lgdt    gdtarg-RELOC 
  510. +#else
  511. +    lgdt    gdtarg-_romstart
  512. +#endif
  513.      mov    %cr0, %eax
  514.      opsize
  515.      or    $CR0_PE, %eax
  516. @@ -276,6 +311,8 @@
  517.  PROT_TO_REAL - Go from Protected Mode to REAL Mode
  518.  **************************************************************************/
  519.      .globl    _prot_to_real
  520. +    .globl    prot_to_real
  521. +prot_to_real:
  522.  _prot_to_real:
  523.      pop    %eax
  524.      sub    $RELOC,%eax        /* Adjust return address */
  525. @@ -293,7 +330,11 @@
  526.       * and reload CS register
  527.       */
  528.      opsize
  529. -    ljmp    $(RELOC)>>4, $2f-RELOC
  530. +#ifndef __linux
  531. +    ljmp    $(RELOC)>>4, $2f-RELOC 
  532. +#else
  533. +    ljmp    $(RELOC)>>4, $2f-_romstart
  534. +#endif
  535.  2:
  536.      /* we are in real mode now
  537.       * set up the real mode segment registers : DS, SS, ES
  538.